package com.lgx.booking.entity;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

import com.lgx.common.entity.IdGenerator;
import com.lgx.common.entity.Image;

/**
 * 房间/包厢/桌位
 * 
 * @author acer
 *
 */
@Entity
@Table(name="TB_BOOKING_DETAIL")
public class BookingDetail implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1595703178605889573L;

	@Id
	@GeneratedValue(strategy=GenerationType.TABLE,generator=IdGenerator.BOOKINGETAIL_ID)
	@TableGenerator(
			name = IdGenerator.BOOKINGETAIL_ID,
			table = IdGenerator.GENERATOR_TABLE,
			pkColumnName = IdGenerator.GEN_NAME,
			pkColumnValue = IdGenerator.BOOKINGETAIL_ID,
			valueColumnName = IdGenerator.GEN_VALUE,
			initialValue = 1,
			allocationSize = 1
	)
	private long id;
	
	/**
	 * 名称
	 */
	private String name;
	
	/**
	 * 所属
	 */
	@ManyToOne
	@JoinColumn(name = "booking_id")
	private Booking booking;
	
	/**
	 * 类型
	 */
	private String type;
	
	/**
	 * 描述
	 */
	private String description;
	
	/**
	 * 实际价格
	 */
	private double tprice;
	
	/**
	 * 优惠价格
	 */
	private double pprice;
	
	/**
	 * 有效时刻
	 */
	private String vaild;
	
	/**
	 * 数量
	 */
	private int count;
	
	/**
	 * 是否可用
	 */
	private String isDelete;
	
	/**
	 * 面积
	 */
	private double area;
	
	/**
	 * 属性1
	 */
	private String prop1;
	
	/**
	 * 属性2
	 */
	private String prop2;
	
	/**
	 * 属性3
	 */
	private String prop3;
	
	/**
	 * 图片
	 */
	@ManyToMany(cascade={CascadeType.ALL},fetch=FetchType.EAGER)    
    @JoinTable(name="TB_BOOKING_DETAIL_IMAGE",   
             joinColumns=@JoinColumn(name="BOOKING_DETAIL_ID"),   
             inverseJoinColumns=@JoinColumn(name="IMAGE_ID")) 
	private Set<Image> images;
	
	/**
	 * 是否特价房
	 */
	@Column(name="isSpecial")
	private boolean special;
	
	/**
	 * 特价价格
	 */
	private double sprice;

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Booking getBooking() {
		return booking;
	}

	public void setBooking(Booking booking) {
		this.booking = booking;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public double getTprice() {
		return tprice;
	}

	public void setTprice(double tprice) {
		this.tprice = tprice;
	}

	public double getPprice() {
		return pprice;
	}

	public void setPprice(double pprice) {
		this.pprice = pprice;
	}

	public String getVaild() {
		return vaild;
	}

	public void setVaild(String vaild) {
		this.vaild = vaild;
	}

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	public String getIsDelete() {
		return isDelete;
	}

	public void setIsDelete(String isDelete) {
		this.isDelete = isDelete;
	}

	public double getArea() {
		return area;
	}

	public void setArea(double area) {
		this.area = area;
	}

	public String getProp1() {
		return prop1;
	}

	public void setProp1(String prop1) {
		this.prop1 = prop1;
	}

	public String getProp2() {
		return prop2;
	}

	public void setProp2(String prop2) {
		this.prop2 = prop2;
	}

	public String getProp3() {
		return prop3;
	}

	public void setProp3(String prop3) {
		this.prop3 = prop3;
	}

	public Set<Image> getImages() {
		return images;
	}

	public void setImages(Set<Image> images) {
		this.images = images;
	}
	
	public double getSprice() {
		return sprice;
	}

	public boolean getSpecial() {
		return special;
	}

	public void setSpecial(boolean special) {
		this.special = special;
	}

	public void setSprice(double sprice) {
		this.sprice = sprice;
	}
}
